﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Pap.Data;
using Pap.Web.Utils;
using Utils;

namespace Pap.Web.Modules.Reports.ViewModel
{
    /// <summary>
    /// 
    /// </summary>
    public class ControlTheMovementOfTheUsersInTheSytemReportViewModel : IViewModel
    {
        /// <summary>
        /// 
        /// </summary>
        IReportRepository _ReportRepository;

        private readonly IMembershipRepository _membershipRepository;

        /// <summary>
        /// Initializes a new instance of the <see cref="ControlTheMovementOfTheUsersInTheSytemReportViewModel"/> class.
        /// </summary>
        /// <param name="repo">The repo.</param>
        /// <param name="membershipRepository"></param>
        public ControlTheMovementOfTheUsersInTheSytemReportViewModel(IReportRepository repo,IMembershipRepository membershipRepository)
        {
            _ReportRepository = repo;
            _membershipRepository = membershipRepository;
        }

        /// <summary>
        /// Gets all responsible users.
        /// </summary>
        /// <returns></returns>
        public IEnumerable<IUser> GetAllResponsibleUsers()
        {
            return _membershipRepository.FindUsersByPermission(Permissions.ResponsibleWaitingList);
        }

        /// <summary>
        /// Gets all committee.
        /// </summary>
        /// <returns></returns>
        public IEnumerable<ICommittee> GetAllCommittee()
        {
            return _ReportRepository.FindCommittee(committee => true);
        }

        /// <summary>
        /// Controlthes the movementof usersofthe system.
        /// </summary>
        /// <param name="Committee">The committee.</param>
        /// <param name="UserName">Name of the user.</param>
        /// <param name="LoanNumber">The loan number.</param>
        /// <param name="FromDate">From date.</param>
        /// <param name="ToDate">To date.</param>
        /// <returns></returns>
        public IEnumerable ControltheMovementofUsersoftheSystem(Guid committee, Guid? userId, int? LoanNumber, DateTime FromDate, DateTime ToDate)
        {
            return _ReportRepository.ControltheMovementofUsersoftheSystem(committee, userId, LoanNumber, FromDate, ToDate);
        }
    }
}